body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Helvetica Neue", sans-serif;
    margin: 0;
    padding: 12px;
    width: 320px;
    height: auto;
    color: rgba(0, 0, 0, 0.85);
    background-color: #ffffff;
}

@media (prefers-color-scheme: dark) {
    body {
        background-color: #1c1c1e;
        color: rgba(255, 255, 255, 0.85);
    }
}

.container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: auto;
}

.header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-bottom: 8px;
    margin-bottom: 2px;
    border-bottom: 1px solid rgba(60, 60, 67, 0.12);
}

.header img {
    width: 28px;
    height: 28px;
}

.header span {
    font-size: 18px;
    font-weight: 600;
    color: #007aff;
}

.key {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.key-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.error-message {
    color: #ff3b30;
    font-size: 13px;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    text-align: center;
    animation: fadeIn 0.2s ease;
    margin-top: 4px;
}

.success-message {
    color: #007aff;
    font-size: 13px;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    text-align: center;
    animation: fadeIn 0.2s ease;
    margin-top: 4px;
}

.input-container {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
    margin-bottom: 12px;
}

input {
    flex: 1;
    padding: 10px 40px 10px 12px;
    font-size: 14px;
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.05);
    border: none;
    transition: all 0.2s ease;
    color: rgba(0, 0, 0, 0.85);
}

@media (prefers-color-scheme: dark) {
    input {
        background-color: rgba(255, 255, 255, 0.08);
        color: rgba(255, 255, 255, 0.85);
    }
}

input::placeholder {
    color: rgba(60, 60, 67, 0.6);
}

@media (prefers-color-scheme: dark) {
    input::placeholder {
        color: rgba(235, 235, 245, 0.6);
    }
}

input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
    background-color: rgba(0, 0, 0, 0.07);
}

@media (prefers-color-scheme: dark) {
    input:focus {
        background-color: rgba(255, 255, 255, 0.12);
    }
}

.toggle-visibility {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.toggle-visibility:hover {
    opacity: 1;
    background-color: rgba(60, 60, 67, 0.1);
}

@media (prefers-color-scheme: dark) {
    .toggle-visibility:hover {
        background-color: rgba(235, 235, 245, 0.1);
    }
}

.toggle-visibility .svg {
    width: 20px;
    height: 20px;
    display: block;
}

@media (prefers-color-scheme: dark) {
    .toggle-visibility .svg {
        filter: brightness(0) invert(1);
    }
}
a {
    color: #007aff;
    font-size: 13px;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

a:hover {
    opacity: 0.7;
}

.language-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(60, 60, 67, 0.12);
}

.language-switch label {
    font-size: 14px;
    font-weight: 500;
}

select {
    min-width: 80px;
    padding: 6px 10px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.85);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
}

@media (prefers-color-scheme: dark) {
    select {
        background-color: rgba(255, 255, 255, 0.08);
        color: rgba(255, 255, 255, 0.85);
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255, 255, 255, 0.85)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    }
}

select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
}

select option {
    background-color: #ffffff;
    color: rgba(0, 0, 0, 0.85);
}

@media (prefers-color-scheme: dark) {
    select option {
        background-color: #1c1c1e;
        color: rgba(255, 255, 255, 0.85);
    }
}

button {
    background-color: #007aff;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

button:hover {
    background-color: #0066d6;
}

button:active {
    transform: scale(0.98);
}

.button-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.button-content svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

@keyframes slideIn {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

.save-feedback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: inherit;
    animation: slideIn 0.2s ease forwards;
}

.save-feedback.hide {
    animation: slideOut 0.2s ease forwards;
}


.setting-item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(60, 60, 67, 0.12);
}

.setting-title {
    margin-bottom: 4px;
    display: flex;
    align-items: center;
}

.setting-description {
    font-size: 12px;
    color: rgba(60, 60, 67, 0.6);
    line-height: 1.4;
}

@media (prefers-color-scheme: dark) {
    .setting-description {
        color: rgba(235, 235, 245, 0.6);
    }
}

.link-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.setting-icon {
    width: 18px;
    height: 18px;
    fill: rgba(0, 0, 0, 0.6);
}
@media (prefers-color-scheme: dark) {
    .setting-icon {
        fill: rgba(255, 255, 255, 0.6);
    }
}
.shortcut-tip {
    margin-top: 16px;
    padding: 12px;
    background-color: rgba(0, 122, 255, 0.08);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
}

@media (prefers-color-scheme: dark) {
    .shortcut-tip {
        background-color: rgba(0, 122, 255, 0.12);
    }
}

.shortcut-tip a {
    color: #007aff;
    text-decoration: underline;
}

.help-link {
    text-align: center;
    padding: 4px 0;
    display: flex;
    justify-content: center;
    gap: 16px;
}

.help-link a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.help-link a:hover {
    background-color: rgba(60, 60, 67, 0.1);
    color: var(--text-primary);
}

.help-link svg {
    width: 16px;
    height: 16px;
}

@media (prefers-color-scheme: dark) {
    .help-link a:hover {
        background-color: rgba(235, 235, 245, 0.1);
    }
}

.language-toggle {
    position: absolute;
    top: 12px;
    right: 20px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
    z-index: 1000;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.language-toggle:hover {
    background-color: rgba(60, 60, 67, 0.1);
}

@media (prefers-color-scheme: dark) {
    .language-toggle:hover {
        background-color: rgba(235, 235, 245, 0.1);
    }
}

.language-toggle svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    color: rgba(60, 60, 67, 0.6);
}

@media (prefers-color-scheme: dark) {
    .language-toggle svg {
        color: rgba(235, 235, 245, 0.6);
    }
}

.balance-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(60, 60, 67, 0.12);
    margin-top: -2px;
}

.balance-text {
    color: rgba(60, 60, 67, 0.6);
}

@media (prefers-color-scheme: dark) {
    .balance-text {
        color: rgba(235, 235, 245, 0.6);
    }
}

.balance-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.balance-content {
    display: none;
    align-items: center;
    gap: 4px;
    animation: fadeIn 0.2s ease;
}

.balance-content.show {
    display: flex;
}

.balance-toggle,
.balance-refresh {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.balance-toggle:hover,
.balance-refresh:hover {
    opacity: 1;
    background-color: rgba(60, 60, 67, 0.1);
}

@media (prefers-color-scheme: dark) {
    .balance-toggle:hover,
    .balance-refresh:hover {
        background-color: rgba(235, 235, 245, 0.1);
    }
}

.balance-toggle img {
    width: 16px;
    height: 16px;
}

.balance-refresh svg {
    width: 14px;
    height: 14px;
    fill: rgba(60, 60, 67, 0.6);
}

@media (prefers-color-scheme: dark) {
    .balance-toggle img,
    .balance-refresh svg {
        filter: brightness(0) invert(1);
        opacity: 0.6;
    }
}

.balance-value {
    color: #007aff;
    font-weight: 500;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.balance-value:hover {
    background-color: rgba(60, 60, 67, 0.1);
}

@media (prefers-color-scheme: dark) {
    .balance-value:hover {
        background-color: rgba(235, 235, 245, 0.1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.loading {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-left-color: #007aff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 4px;
}

@media (prefers-color-scheme: dark) {
    .loading {
        border-color: rgba(255, 255, 255, 0.1);
        border-left-color: #007aff;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.selection-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(60, 60, 67, 0.12);
}

.selection-switch label {
    font-size: 14px;
    font-weight: 500;
}

.switch-wrapper {
    position: relative;
    width: 44px;
    height: 26px;
}

.switch-input {
    display: none;
}

.switch-label {
    position: absolute;
    top: 0;
    left: 0;
    width: 44px;
    height: 26px;
    border-radius: 34px;
    background-color: rgba(120, 120, 128, 0.32);
    cursor: pointer;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-label:before {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-input:checked + .switch-label {
    background-color: #34C759;
}

.switch-input:checked + .switch-label:before {
    transform: translateX(18px);
}

@media (prefers-color-scheme: dark) {
    .switch-label {
        background-color: rgba(120, 120, 128, 0.32);
    }

    .switch-label:before {
        background-color: rgba(255, 255, 255, 0.85);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    }

    .switch-input:checked + .switch-label {
        background-color: #30D158;
    }

    .switch-input:checked + .switch-label:before {
        background-color: #ffffff;
    }
}

/* 添加悬停和焦点状态 */
.switch-label:hover:before {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.switch-input:focus + .switch-label:before {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(0, 122, 255, 0.2);
}

@media (prefers-color-scheme: dark) {
    .switch-label:hover:before {
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    }

    .switch-input:focus + .switch-label:before {
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(0, 122, 255, 0.3);
    }
}

.verify-button {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background-color: #007aff;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.verify-button:hover {
    background-color: #0066d6;
}

.verify-button:active {
    transform: translateY(-50%) scale(0.98);
}

/* 添加提示样式 */
.switch-label-text {
    position: relative;
    cursor: default;
}

.switch-label-text:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: -8px;
    bottom: calc(100% + 4px);
    background: rgba(35, 37, 40, 0.95);
    color: rgba(238, 238, 238, 0.95);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.3;
    white-space: normal;
    width: 300px;
    z-index: 1000;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: tooltipFadeIn 0.2s ease;
    pointer-events: none;
}

@media (prefers-color-scheme: dark) {
    .switch-label-text:hover::after {
        background: rgba(45, 47, 50, 0.95);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    }
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}